package com.cj.factory;

import okhttp3.OkHttpClient;
import org.springframework.beans.factory.FactoryBean;

/**
 *
 *
 * FactoryBean接口，，， 里面指定一个范型，，，
 * @author cc
 * @date 2025-05-12 16:31
 **/

public class OkHttpClientFactoryBean implements FactoryBean<OkHttpClient> {
    @Override
    public OkHttpClient getObject() throws Exception {
        OkHttpClient.Builder builder = new OkHttpClient.Builder();

        builder.setConnectTimeout$okhttp(5000);
        builder.setReadTimeout$okhttp(5000);
        return builder.build();
    }

    @Override
    public Class<?> getObjectType() {
        return OkHttpClient.class;
    }

    @Override
    public boolean isSingleton() {
        return FactoryBean.super.isSingleton();
    }
}
